<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增存储插件配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-stroage-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">类型：</label>
                <div class="col-sm-8">
                    <select name="type" class="form-control select2-multiple" th:with="type=${@dict.getType('setting_storage_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">ACCESS_ID：</label>
                <div class="col-sm-8">
                    <input name="accessId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">ACCESS_KEY：</label>
                <div class="col-sm-8">
                    <input name="accessKey" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">BUCKET_NAME：</label>
                <div class="col-sm-8">
                    <input name="bucketName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">URL前缀：</label>
                <div class="col-sm-8">
                    <input name="urlPri" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">排序：</label>
                <div class="col-sm-8">
                    <input name="order" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否启用：</label>
                <div class="col-sm-3">
                    <label class="toggle-switch switch-solid">
                        <input type="checkbox" id="IsUsed" checked>
                        <span></span>
                    </label>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/stroage"
        $("#form-stroage-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var isUsed   = $("input[id='IsUsed']").is(':checked') == true ? 1 : 0;
                var data = $.param({'isUsed': isUsed}) + '&' +
                    $('#form-stroage-add').serialize();
                $.operate.save(prefix + "/add", data);
            }
        }
    </script>
</body>
</html>